
Imports XL.Common
Imports XL.Common.Utils

Public Class S_03_00102
    Inherits XL.DB.Utils.BaseService
    Public Shared Function GetInstance() As S_03_00102

        Dim result As S_03_00102
        If AssetVisionXAuto.Decls.CURRENT_DB_TYPE = XL.DB.DBDecl.DBType.Remoting Then

            result = CType(Activator.GetObject(GetType(S_03_00102), _
                String.Format("tcp://{0}/S_03_00102.remote", _
                    SysInfo.ReadLocalSysInfo(CommDecl.XLSLVN_SYSTEM_REMOTE_SERVICE_URL))),  _
                S_03_00102)

            If result.ValidateAuthPassword(CommDecl.CURRENT_LOCAL_REMOTE_AUTH_PASSWORD) = False Then
                Dim ex As New XLException(XLException.ErrorClassify.ReadDataError)
                ex.SetMessage(CommDecl.MSG_ALERT_REMOTE_AUTH_DENIED)
                Throw ex
            End If

        Else

            result = New S_03_00102
        End If

        Return result

    End Function

    Public Enum LCs
        None
        Utld0002
        Utld0003
        Utld0004
        Utld0005
    End Enum


    Public Function ServAddChosenAssetIDs( _
        ByVal valChosenDtlAssetIDs As String, _
        ByRef refBindingRemoveDtlList As AssetVisionXAuto.FTs.FT_XV_H_AV_ASSET_ABSENT _
        ) As String
        Try


            Dim assetList As New AssetVisionXAuto.FTs.FT_XV_T_AV_ASSET
            Dim assetCondition As New AssetVisionXAuto.Facade.AfXV.ConditionOfXV_T_AV_ASSET(XL.DB.Utils.Condition.LogicOperators.Logic_And)
            Dim bindingRow As AssetVisionXAuto.FTs.FT_XV_H_AV_ASSET_ABSENTRow = Nothing

            Dim existingIDs As New ArrayList
            For Each bindingRow In refBindingRemoveDtlList
                existingIDs.Add(bindingRow.ASSET_ID)
            Next
            assetCondition.Add(AssetVisionXAuto.Facade.AfXV.XV_T_AV_ASSETColumns.ASSET_IDColumn, True, CommTK.StrToAL(valChosenDtlAssetIDs))
            assetCondition.Add(AssetVisionXAuto.Facade.AfXV.XV_T_AV_ASSETColumns.ASSET_IDColumn, False, existingIDs)

            AssetVisionXAuto.Facade.AfXV.FillFT_XV_T_AV_ASSET(assetCondition, assetList)


            Dim runnerStaffRow As AssetVisionXAuto.FTs.FT_M_AV_STAFFRow
            For Each assetRow As AssetVisionXAuto.FTs.FT_XV_T_AV_ASSETRow In assetList


                bindingRow = refBindingRemoveDtlList.NewXV_H_AV_ASSET_ABSENTRow
                refBindingRemoveDtlList.AddXV_H_AV_ASSET_ABSENTRow(bindingRow)
                bindingRow.CloneDataRow(assetRow, False)

                bindingRow.PRINCIPAL__STAFF_ID = assetRow.CURRENT_PRINCIPAL__STAFF_ID
                bindingRow.PRINCIPAL__STAFF_NAME = assetRow.CURRENT_PRINCIPAL__STAFF_NAME
                bindingRow.PRINCIPAL__STAFF_CODE = assetRow.CURRENT_PRINCIPAL__STAFF_CODE

                runnerStaffRow = AssetVisionXAuto.Facade.AfBizMaster.GetM_AV_STAFFRow(assetRow.CURRENT_RUNNER)
                If IsNothing(runnerStaffRow) = False Then
                    bindingRow.EXECUTOR__STAFF_ID = runnerStaffRow.STAFF_ID
                    bindingRow.EXECUTOR__STAFF_NAME = runnerStaffRow.STAFF_NAME
                    bindingRow.EXECUTOR__STAFF_CODE = runnerStaffRow.STAFF_CODE

                End If


            Next

        Catch ex As XL.Common.Utils.XLException

            Dim logContentBuilder As New LineStrBuilder
            logContentBuilder.AppendLine("Message: {0}", ex.Message)
            logContentBuilder.AppendLine("Stack Trace: {0}", ex.StackTrace)

            'WinTK.OutputLog("XL Exception", logContentBuilder.ToString())

            Return logContentBuilder.ToString()

        Catch ex As Exception

            Dim logContentBuilder As New LineStrBuilder
            logContentBuilder.AppendLine("Message: {0}", ex.Message)
            logContentBuilder.AppendLine("Stack Trace: {0}", ex.StackTrace)


            Return logContentBuilder.ToString()

        End Try
        Return String.Empty

    End Function


    Public Function ServBizUtld0002( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0003( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0004( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0005( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0006( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0007( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0008( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0009( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0010( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0011( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0012( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0013( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0014( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0015( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0016( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0017( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0018( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0019( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


    Public Function ServBizUtld0020( _
        ByVal valParaUtld As String, _
        ByRef refParaUtld As String _
        ) As String




        Return String.Empty

    End Function


End Class

